<template>
  <div class="controlBar">
    <div class="title" title="按住拖动">
      <div v-if="dashboard">绿农瑞丰物流系统</div>
    </div>
    <div class="control">
      <div class="minx"
           @click="minWindow"
           title="最小化">
        <i class="el-icon-minus"></i>
      </div>
      <div class="close"
           @click="closeWindow"
           title="关闭">
        <i class="el-icon-close"></i>
      </div>
    </div>
  </div>
</template>

<script>
import { ipcRenderer } from 'electron'
export default {
  data() {
    return {
      dashboard: false
    }
  },
  methods: {
    // 打开登录窗体
    openLoginWindow() {
      ipcRenderer.send('openLoginPageWindow')
    },
    // 最小化窗体
    minWindow() {
      console.log('最小化')
      ipcRenderer.send('minWindow')
    },
    // 最大化窗体
    maxWindow() {
      ipcRenderer.send('maxWindow')
    },
    // 关闭窗体
    closeWindow() {
      ipcRenderer.send('closeWindow')
    }
  }
}
</script>

<style scoped>
.controlBar {
  padding: 0px 10px 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #889aa4;
  height: 40px;
}
.control {
  display: inline-block;
  min-width: 100px;
  text-align: right;
  padding: 5px 10px 0 0;
}
.minx,
.close {
  display: inline-block;
  padding: 5px;
  font-size: 22px;
  cursor: pointer;
}
.title {
  padding: 5px;
  -webkit-app-region: drag;
  width: 100%;
  height: 40px;
}
</style>